reopen_log();
+ /* make sure xenstored directory exists */
+ if (mkdir(xs_daemon_rundir(), 0755)) {
+ if (errno != EEXIST) {
+ perror("error: mkdir daemon rundir");
+ exit(-1);
+ }
+ }
+
+ if (mkdir(xs_daemon_rootdir(), 0755)) {
+ if (errno != EEXIST) {
+ perror("error: mkdir daemon rootdir");
+ exit(-1);
+ }
+ }
+
if (dofork) {
openlog("xenstored", 0, LOG_DAEMON);
daemonize();
/* Common routines for the Xen store daemon and client library. */
-static const char *xs_daemon_rootdir(void)
+const char *xs_daemon_rootdir(void)
{
char *s = getenv("XENSTORED_ROOTDIR");
return (s ? s : "/var/lib/xenstored");
}
-static const char *xs_daemon_rundir(void)
+const char *xs_daemon_rundir(void)
{
char *s = getenv("XENSTORED_RUNDIR");
return (s ? s : "/var/run/xenstored");
#define MAX_STRLEN(x) ((sizeof(x) * CHAR_BIT + CHAR_BIT-1) / 10 * 3 + 2)
/* Path for various daemon things: env vars can override. */
+const char *xs_daemon_rootdir(void);
+const char *xs_daemon_rundir(void);
const char *xs_daemon_socket(void);
const char *xs_daemon_socket_ro(void);
const char *xs_domain_dev(void);